<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简谱转古琴指法转换器</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        html, body {
            height: 100%;
            overflow-x: hidden;
            font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
        }
        
        body {
            background: linear-gradient(135deg, #f9f3e9 0%, #f0e4d3 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding: 20px;
            color: #5c3b1e;
            line-height: 1.6;
            position: relative;
            overflow: auto;
        }
        
        /* 中国风装饰 */
        .chinese-pattern {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: 
                radial-gradient(circle at 10% 20%, rgba(165, 42, 42, 0.03) 0%, transparent 20%),
                radial-gradient(circle at 90% 80%, rgba(165, 42, 42, 0.03) 0%, transparent 20%),
                radial-gradient(circle at 50% 30%, rgba(212, 167, 106, 0.03) 0%, transparent 25%);
            z-index: 0;
            pointer-events: none;
        }
        
        .container {
            max-width: 1100px;
            width: 100%;
            background: rgba(255, 253, 245, 0.95);
            border-radius: 15px;
            box-shadow: 0 15px 50px rgba(92, 59, 30, 0.2);
            overflow: hidden;
            position: relative;
            z-index: 1;
            border: 2px solid #d4a76a;
            margin: 30px 0;
        }
        
        .header {
            background: linear-gradient(to right, #8b4513, #a52a2a);
            color: #f5e9d4;
            padding: 35px 40px;
            text-align: center;
            position: relative;
            overflow: hidden;
            border-bottom: 3px solid #d4a76a;
        }
        
        .header h1 {
            font-size: 2.8rem;
            margin-bottom: 10px;
            position: relative;
            z-index: 2;
            text-shadow: 0 2px 10px rgba(0,0,0,0.3);
            letter-spacing: 3px;
        }
        
        .header p {
            font-size: 1.2rem;
            max-width: 700px;
            margin: 0 auto;
            opacity: 0.9;
            position: relative;
            z-index: 2;
        }
        
        .header::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none"/><path d="M20,20 Q40,10 50,20 T80,20" stroke="%23d4a76a" stroke-width="0.8" fill="none"/></svg>');
            background-size: 150px 150px;
            opacity: 0.1;
            z-index: 1;
        }
        
        .content {
            display: flex;
            flex-wrap: wrap;
            padding: 30px;
        }
        
        .input-section, .output-section {
            flex: 1;
            min-width: 300px;
            padding: 25px;
        }
        
        .section-title {
            font-size: 1.8rem;
            margin-bottom: 20px;
            color: #8b4513;
            display: flex;
            align-items: center;
            padding-bottom: 10px;
            border-bottom: 2px solid #d4a76a;
        }
        
        .section-title i {
            margin-right: 10px;
            background: #8b4513;
            color: #f5e9d4;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .input-area {
            background: #fffaf0;
            border: 2px solid #d4a76a;
            border-radius: 12px;
            padding: 25px;
            min-height: 220px;
            margin-bottom: 25px;
            position: relative;
            transition: all 0.3s ease;
            box-shadow: inset 0 0 10px rgba(139, 69, 19, 0.1);
        }
        
        .input-area:focus-within {
            border-color: #a52a2a;
            background: #fff8e8;
            box-shadow: inset 0 0 15px rgba(165, 42, 42, 0.15);
        }
        
        .input-area textarea {
            width: 100%;
            height: 150px;
            border: none;
            background: transparent;
            resize: none;
            font-size: 1.4rem;
            font-family: inherit;
            color: #5c3b1e;
            outline: none;
            line-height: 2;
            padding: 5px;
        }
        
        .example {
            background: #fff8e8;
            border-radius: 10px;
            padding: 15px;
            margin-top: 15px;
            font-size: 0.95rem;
            border: 1px dashed #d4a76a;
        }
        
        .example h3 {
            margin-bottom: 8px;
            color: #a52a2a;
            font-size: 1.1rem;
        }
        
        .convert-btn {
            display: block;
            width: 100%;
            padding: 18px;
            background: linear-gradient(to right, #8b4513, #a52a2a);
            color: #f5e9d4;
            border: none;
            border-radius: 10px;
            font-size: 1.3rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            font-family: inherit;
            position: relative;
            overflow: hidden;
            z-index: 1;
            letter-spacing: 2px;
            box-shadow: 0 5px 15px rgba(139, 69, 19, 0.3);
        }
        
        .convert-btn::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(to right, #a52a2a, #8b4513);
            opacity: 0;
            transition: opacity 0.3s ease;
            z-index: -1;
        }
        
        .convert-btn:hover::before {
            opacity: 1;
        }
        
        .convert-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(139, 69, 19, 0.5);
        }
        
        .convert-btn:active {
            transform: translateY(1px);
        }
        
        .output-area {
            background: #fffaf0;
            border-radius: 12px;
            padding: 25px;
            min-height: 320px;
            border: 2px solid #d4a76a;
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            justify-content: flex-start;
            align-items: flex-start;
            box-shadow: inset 0 0 10px rgba(139, 69, 19, 0.1);
            max-height: 500px;
            overflow-y: auto;
        }
        
        .output-area.empty {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: #a0a0c0;
            min-height: 320px;
        }
        
        .output-area.empty i {
            font-size: 4rem;
            margin-bottom: 20px;
            color: #d4a76a;
            opacity: 0.7;
        }
        
        /* 全新卡片设计 - 横向布局 */
        .guqin-note {
            background: linear-gradient(135deg, #fffdf5 0%, #fff8eb 100%);
            border: 2px solid #d4a76a;
            border-radius: 12px;
            height: 100px;
            display: flex;
            align-items: center;
            font-size: 1.1rem;
            color: #5c3b1e;
            box-shadow: 0 8px 20px rgba(139, 69, 19, 0.15);
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
            padding: 0 25px;
        }
        
        /* 卡片左侧装饰 */
        .note-decor {
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            width: 10px;
            background: linear-gradient(to bottom, #a52a2a, #8b4513);
        }
        
        .note-content {
            display: flex;
            align-items: center;
            gap: 20px;
            padding-left: 15px;
        }
        
        .note-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            min-width: 90px;
        }
        
        .note-label {
            font-size: 0.9rem;
            color: #8b4513;
            margin-bottom: 5px;
            opacity: 0.8;
            letter-spacing: 1px;
        }
        
        .note-value {
            font-size: 1.4rem;
            font-weight: bold;
            color: #5c3b1e;
            background: rgba(212, 167, 106, 0.15);
            padding: 8px 15px;
            border-radius: 10px;
            min-width: 80px;
            text-align: center;
        }
        
        .note-divider {
            height: 50px;
            width: 1px;
            background: linear-gradient(to bottom, transparent, #d4a76a, transparent);
            opacity: 0.5;
        }
        
        .footer {
            text-align: center;
            padding: 25px;
            background: #fffaf0;
            color: #8b4513;
            font-size: 0.9rem;
            border-top: 2px solid #d4a76a;
        }
        
        .divider {
            width: 1px;
            background: linear-gradient(to bottom, transparent, #d4a76a, transparent);
            margin: 0 20px;
        }
        
        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateX(-20px); }
            to { opacity: 1; transform: translateX(0); }
        }
        
        .guqin-note {
            animation: fadeIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
            opacity: 0;
        }
        
        .convert-btn i {
            display: inline-block;
            margin-left: 8px;
            transition: transform 0.3s ease;
        }
        
        .convert-btn:hover i {
            transform: rotate(90deg);
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .content {
                flex-direction: column;
            }
            
            .divider {
                width: 100%;
                height: 1px;
                margin: 20px 0;
                background: linear-gradient(to right, transparent, #d4a76a, transparent);
            }
            
            .header h1 {
                font-size: 2.2rem;
            }
            
            .output-area {
                max-height: 300px;
                justify-content: center;
            }
            
            .guqin-note {
                height: 90px;
                padding: 0 20px;
            }
            
            .note-content {
                gap: 15px;
            }
            
            .note-item {
                min-width: 70px;
            }
            
            .note-value {
                font-size: 1.2rem;
                padding: 6px 12px;
            }
        }
        
        /* 新增：卡片悬停效果 */
        .guqin-note:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 25px rgba(139, 69, 19, 0.2);
            border-color: #a52a2a;
        }
        
        .guqin-note:hover .note-decor {
            background: linear-gradient(to bottom, #8b4513, #a52a2a);
        }
        
        /* 新增：音乐波纹动画 */
        .music-wave {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border-radius: 12px;
            overflow: hidden;
            z-index: -1;
            opacity: 0.05;
        }
        
        .wave-bar {
            position: absolute;
            bottom: 0;
            height: 10px;
            background: #a52a2a;
            animation: wave 1.2s infinite ease-in-out;
            opacity: 0.6;
        }
        
        @keyframes wave {
            0%, 100% { height: 10px; }
            50% { height: 30px; }
        }
    </style>
</head>
<body>
    <div class="chinese-pattern"></div>
    
    <div class="container">
        <div class="header">
            <h1>简谱转古琴指法转换器</h1>
            <p>将现代简谱转换为古琴弹奏指法，传承千年琴韵</p>
        </div>
        
        <div class="content">
            <div class="input-section">
                <h2 class="section-title"><i class="fas fa-music"></i> 简谱输入</h2>
                <div class="input-area">
                    <textarea id="input-notes" placeholder="请输入简谱（例如：1 2 3 5 6）&#10;可用数字1-7表示音符，空格分隔"></textarea>
                </div>
                
                <div class="example">
                    <h3>示例曲谱：</h3>
                    <p>《阳关三叠》片段：<strong>5 6 5 3 2 1 2 3 2 1 6 5</strong></p>
                    <p>《梅花三弄》片段：<strong>3 5 6 1 2 3 5 6 1 2 3 2 1</strong></p>
                    <p>《高山流水》片段：<strong>1 2 3 5 5 6 5 3 2 1 2 3</strong></p>
                    <p>《渔舟唱晚》片段：<strong>5 6 1 2 3 2 1 6 5 3 2 1</strong></p>
                </div>
                
                <button id="convert-btn" class="convert-btn">
                    转换指法 <i class="fas fa-exchange-alt"></i>
                </button>
            </div>
            
            <div class="divider"></div>
            
            <div class="output-section">
                <h2 class="section-title"><i class="fas fa-hand-point-up"></i> 古琴指法</h2>
                <div id="output-area" class="output-area empty">
                    <i class="fas fa-guitar"></i>
                    <p>转换结果将显示在这里</p>
                </div>
            </div>
        </div>
        
        <div class="footer">
            <p>© 2023 古琴指法转换器 | 传承千年琴韵 · 弘扬传统文化</p>
            <p>古琴艺术 · 非物质文化遗产 · 十三徽位传统</p>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const convertBtn = document.getElementById('convert-btn');
            const inputNotes = document.getElementById('input-notes');
            const outputArea = document.getElementById('output-area');
            
            // 简谱到古琴指法的映射
            const noteToGuqin = {
                '1': { string: "一弦", position: "九徽", finger: "大指" },
                '2': { string: "二弦", position: "七徽", finger: "食指" },
                '3': { string: "三弦", position: "十徽", finger: "中指" },
                '4': { string: "四弦", position: "八徽", finger: "名指" },
                '5': { string: "五弦", position: "七徽", finger: "大指" },
                '6': { string: "六弦", position: "五徽", finger: "食指" },
                '7': { string: "七弦", position: "六徽", finger: "中指" }
            };
            
            // 创建音乐波纹
            function createMusicWaves(element) {
                const waveContainer = document.createElement('div');
                waveContainer.className = 'music-wave';
                
                // 创建多个波纹条
                for (let i = 0; i < 8; i++) {
                    const waveBar = document.createElement('div');
                    waveBar.className = 'wave-bar';
                    waveBar.style.left = `${i * 12.5}%`;
                    waveBar.style.width = '10%';
                    waveBar.style.animationDelay = `${i * 0.1}s`;
                    waveContainer.appendChild(waveBar);
                }
                
                element.appendChild(waveContainer);
                
                // 5秒后移除波纹
                setTimeout(() => {
                    waveContainer.remove();
                }, 2000);
            }
            
            // 转换函数
            function convertToGuqin(notes) {
                const noteArray = notes.split(' ');
                outputArea.innerHTML = '';
                outputArea.classList.remove('empty');
                
                // 添加动画延迟
                noteArray.forEach((note, index) => {
                    setTimeout(() => {
                        if (noteToGuqin[note]) {
                            const noteElement = document.createElement('div');
                            noteElement.className = 'guqin-note';
                            
                            noteElement.innerHTML = `
                                <div class="note-decor"></div>
                                <div class="note-content">
                                    <div class="note-item">
                                        <div class="note-label">弦位</div>
                                        <div class="note-value">${noteToGuqin[note].string}</div>
                                    </div>
                                    <div class="note-divider"></div>
                                    <div class="note-item">
                                        <div class="note-label">徽位</div>
                                        <div class="note-value">${noteToGuqin[note].position}</div>
                                    </div>
                                    <div class="note-divider"></div>
                                    <div class="note-item">
                                        <div class="note-label">指法</div>
                                        <div class="note-value">${noteToGuqin[note].finger}</div>
                                    </div>
                                </div>
                            `;
                            
                            noteElement.style.animationDelay = `${index * 0.1}s`;
                            outputArea.appendChild(noteElement);
                            
                            // 创建音乐波纹效果
                            createMusicWaves(noteElement);
                        }
                    }, 300 * index);
                });
            }
            
            // 按钮点击事件
            convertBtn.addEventListener('click', function() {
                const notes = inputNotes.value.trim();
                
                if (!notes) {
                    outputArea.innerHTML = '<i class="fas fa-exclamation-circle"></i><p>请输入简谱音符</p>';
                    outputArea.classList.add('empty');
                    return;
                }
                
                // 添加按钮动画
                convertBtn.innerHTML = '转换中 <i class="fas fa-spinner fa-spin"></i>';
                convertBtn.disabled = true;
                
                // 模拟转换过程
                setTimeout(() => {
                    convertToGuqin(notes);
                    convertBtn.innerHTML = '转换指法 <i class="fas fa-exchange-alt"></i>';
                    convertBtn.disabled = false;
                }, 800);
            });
            
            // 初始化示例
            inputNotes.value = "5 6 5 3 2 1 2 3 2 1 6 5";
        });
    </script>
</body>
</html>